package com.test.data;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class UserServiceImpl implements UserService {
    @Autowired
    UserRepository userRepository;

    @Override
    public String addUser(User user) {
        User savedUser = userRepository.save(user);
        return savedUser.toString();
    }

    @Override
    public User getUser(String id) {
        return userRepository.getOne(id);
    }

    @Override
    public User test() {
        return new User("1001", "zhp", "123456");
    }
}
